﻿using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace SuporeSliplampApp.Util
{
    public class util
    {
        public static int ComboBox_SelectedIndex = 0;
        public static int Image_SelectedIndex = 1;
        public static bool isPatientSelected = false;
        public static string getPicName(string path)
        {
            int m = path.LastIndexOf(@"\");
            int n = path.LastIndexOf(".");
            return path.Substring(m + 1, n - m - 1);
        }

        //public class picModel
        //{
        //    public  string Path { get; set; }
        //    public  string Name { get; set; }
        //}
        static Regex reUnicode = new Regex(@"\\u([0-9a-fA-F]{4})", RegexOptions.Compiled);
        public static string Decode(string s)
        {
            return reUnicode.Replace(s, m =>
            {
                short c;
                if (short.TryParse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture, out c))
                {
                    return "" + (char)c;
                }
                return m.Value;
            });
        }
    }
}
